<extend name="Public/base"/>

<block name="body">

	 <link href="__MOBILE__/css/list.css" rel="stylesheet">
	 <div class="container"> <h2 style="font-size:16px;">搜索词：{$keyword}</h2>
	 	<include file="Public:goods_list" />
	 	<notempty name="_page">
    	 <div class="row">
	        	<div class="col-sm-12 ">
					<button id="next" class="btn" p="2" total-page="{$total_page}">
						点击加载更多
					</button>
				</div>
	      </div>
    </notempty>
	 </div>
	


    
    <script>
    $(function(){	
		$('#next').click(function(){
		  	LoadPage();  
		}); 
		$('.lazy').lazyload();
		
	});
    function LoadPage(){
		var keyword = '{$keyword}';
		var currentPage = $('#next').attr('p') ? $('#next').attr('p') : 1;
		$.get("{:U('Search/index')}",{'p':currentPage,'keywords':keyword},function(result){
			if(result.errno==0){
				$('.goods-list .list').append(result.content);
				$('#next').attr('p',result.p);
				if(result.p>$('#next').attr('total-page')){
					$('#next').html('木有了，亲');
					$('#next').attr('disabled',true);
					$('#next').addClass('disabled');
				}
			}
			
		},'json');	
	}
    </script>
</block>